package dq.study.minimvc.paramter;

import dq.study.minimvc.annotation.SimpleParam;

import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Parameter;

public class SimpleArguementResolver implements MethodArgumentResolver {
    @Override
    public boolean supportsParameter(Parameter parameter) {
        if (parameter.getAnnotation(SimpleParam.class)!=null){
            return true;
        }
        return false;
    }

    @Override
    public Object resolveArgument(Parameter parameter, HttpServletRequest request) throws Exception {
        return request.getParameter(parameter.getName());
    }
}
